/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2024-2024.
 * Description: RTOS bti userspace permissive mode code
 * Author: wanghuizhao
 * Create: 2024-07-14
 */

#include <linux/kernel.h>
#include <linux/rtos/cfi_permissive_mode.h>
#include <asm/ptrace.h>

// The permissive mode needs to be enabled by default for wireless products.
static bool bti_permissive_enabled = true;

bool get_bti_permissive_enabled(void)
{
	return bti_permissive_enabled;
}
EXPORT_SYMBOL_NS(get_bti_permissive_enabled, HW_RTOS_NS);

static int __init bti_permissive_setup(char *str)
{
	int val = 0;

	if (!get_option(&str, &val))
		return 0;
	if (val == 0)
		bti_permissive_enabled = false;

	return 1;
}
__setup("bti_permissive=", bti_permissive_setup);

